import 'package:flutter/material.dart';
import 'package:flutter_house_manager/components/nav_col.dart';

class HomeNav extends StatefulWidget {
  const HomeNav({super.key});

  @override
  State<HomeNav> createState() => _HomeNavState();
}

class _HomeNavState extends State<HomeNav> {
  final List _navList = [
    {'title': '我的房屋', 'icon': 'assets/images/house_nav_icon@2x.png'},
    {'title': '我的保修', 'icon': 'assets/images/repair_nav_icon@2x.png'},
    {'title': '访客登记', 'icon': 'assets/images/visitor_nav_icon@2x.png'}
  ];

  List<Widget> _getNavList() {
    return _navList.map((item) {
      return NavCol(icon: item['icon'], title: item['title']);
    }).toList();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.all(10),
      padding: const EdgeInsets.only(top: 10, bottom: 10),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(10), color: Colors.white),
      child: Row(
        children: _getNavList(),
      ),
    );
  }
}

/*   Widget _navItem(item) {
    return Container(
      padding: const EdgeInsets.symmetric(vertical: 10),
      child: Column(
        children: [
          Image.asset(
            item['icon'],
            width: 35,
            height: 35,
          ),
          const SizedBox(height: 5),
          Text(item['title']),
        ],
      ),
    );
  } */

